home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD-ROM Magazine 28 Bonus
/
CDRomMagazine-SoftKey-ArtPassion-FrenchVersion-Win31Mac.bin
/
data
/
cngrkpl.dir
/
00121_Script_DRAG PIECE HANDLERS (REUSED)
< prev
next >
Wrap
Text File
|
1996-05-30
|
2KB
|
78 lines
-- -----------------------------------------------------------
-- The following handlers are used in games where pieces have
-- to be dragged to their proper locations (the shadow game
-- and the golden section game).
-- -----------------------------------------------------------
-- Handler updateCurrentPlacedPiece sets the global variable
-- currentPlacedPiece to its value + 1. This handler is
-- called when the user successfully places a shadow onstage.
on updateCurrentPlacedPiece
global currentPlacedPiece
set currentPlacedPiece = currentPlacedPiece + 1
end
-- ---------------------------------------------------------------
-- Handler movePiece
on movePiece whichSprite
-- empty script for the clickOn to work
end
-- ---------------------------------------------------------------
-- Handler trackAndCheck
on trackAndCheck ClickedSprite, checkHandler, matchHandler
global gameOver,numOutlines,totalPlaced, totalPieces
set oldH = the locH of sprite ClickedSprite
set oldV = the locV of sprite ClickedSprite
-- drag the piece while the mouse is down
repeat while the stillDown
SpriteFollowMouse( ClickedSprite)
updateTimer
if gameOver then exit
end repeat
-- the mouse is now Up, ie. the user placed the piece somewhere
-- check if the piece was placed in the right place
do checkhandler
put the result into dragResults
if dragResults then
playNarration "Correct"
do matchHandler
set totalPlaced = totalPlaced + 1
else
playNarration "Missed"
returnIt ClickedSprite, oldH, oldV
end if
if totalPlaced = totalPieces then success
end
-- ---------------------------------------------------------------
-- Handler spriteFollowMouse
on spriteFollowMouse whichSprite
-- move the piece with the mouse
set the locH of sprite whichSprite = the mouseH
set the locV of sprite whichSprite = the mouseV
updateStage
end
-- return the piece to it's original location
on returnIt aSprite,alocH,aLocV
set the locH of sprite aSprite to aLocH
set the locV of sprite aSprite to aLocV
updatestage
end